<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>排片资料维护</title>
    <jsp:include page="/IncludeJS.jsp"></jsp:include>
</head>
<body onload="init();">
<script type="text/javascript">
    function save() {
        document.forms[0].submit();
    }

    function check() {
        return true;
    }

    function back() {
        location.href = "${pageContext.request.contextPath }/plan/list";
    }

    if ("${msg}" != null && "${msg}".length > 0) {
        alert("${msg}");
    }

    function init() {
        var key = $("#id").val();
        if (key == "0") {
            var d = new Date();
            var y = d.getFullYear();
            var m = d.getMonth() + 1;
            var d = d.getDate();
            $("#playDay").datebox("setValue", y + "-" + m + "-" + d);
        } else {
            var td = $("#playDay").val();
            if (td != "" && td.substring(0, 1) != '2') {
                td = "20" + td;
                $("#playDay").datebox("setValue", td.substring(0, 10));
            }
        }
    }
</script>
<table width="100%" border="0" cellpadding="0" cellspacing="0" BACKGROUND="images/maintitle.jpg">
    <tr>
        <td align="left">
            <a class="easyui-linkbutton" plain="true" icon="icon-undo" href="javascript:void(0);"
               onclick="back();">返回</a>
        </td>
    </tr>
</table>
<form action="${pageContext.request.contextPath }/plan/save" enctype="multipart/form-data" method="post"
      onsubmit="return check();">
    <input type="hidden" name="planId" id="id" value="${plan.planId}"/>
    <table cellpadding="0" cellspacing="0" border="0" style="margin: 0 auto" align="left">
        <tr height="30">
            <td align="right">影厅</td>
            <td>
                <select name="hallId" id="hallId" style="width:250px">
                    <c:forEach items="${hallList}" var="v">
                        <c:if test="${plan.hallId==v.hallId}">
                            <option value="${v.hallId}" selected>${v.hallName}</option>
                        </c:if>
                        <c:if test="${plan.hallId!=v.hallId}">
                            <option value="${v.hallId}">${v.hallName}</option>
                        </c:if>
                    </c:forEach>
                </select>
            </td>
        </tr>
        <tr>
            <td align="right">电影</td>
            <td>
                <select name="movieId" id="movieId" style="width:250px">
                    <c:forEach items="${movieList}" var="v">
                        <c:if test="${plan.movieId==v.movieId}">
                            <option value="${v.movieId}" selected>${v.movieName}</option>
                        </c:if>
                        <c:if test="${plan.movieId!=v.movieId}">
                            <option value="${v.movieId}">${v.movieName}</option>
                        </c:if>
                    </c:forEach>
                </select>
            </td>
        </tr>
        <tr height="30">
            <td align="right" width="90">时段</td>
            <td>
                <select name="playTimeId" id="playTimeId" style="width:250px">
                    <c:forEach items="${playTimeList}" var="v">
                        <c:if test="${plan.playTimeId==v.playTimeId}">
                            <option value="${v.playTimeId}" selected>${v.playTimeName}(${v.startTime}-${v.endTime})
                            </option>
                        </c:if>
                        <c:if test="${plan.playTimeId!=v.playTimeId}">
                            <option value="${v.playTimeId}">${v.playTimeName}(${v.startTime}-${v.endTime})</option>
                        </c:if>
                    </c:forEach>
                </select>
            </td>
        </tr>
        <tr height="30">
            <td align="right" width="120">票价</td>
            <td><input type="text" name="seatPrice" id="seatPrice" style="width:250px" value="${plan.seatPrice}"/><font
                    size="2" color="red">*</font></td>
        </tr>
        <tr height="30">
            <td align="right" width="120">排片日期</td>
            <td><input type="text" name="playDay" id="playDay" style="width:250px" class="easyui-datebox"
                       value="${plan.playDay}"/></td>
        </tr>
        <tr height="30">
            <td>&nbsp;</td>
            <td colspan="3"><input type="submit" value="   保 存   "></input></td>
        </tr>
    </table>
</form>
</body>
</html>